﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimpleInOutControl.DBModels
{
    /// <summary>
    /// 设备信息
    /// </summary>
    [SugarTable(TableDescription = "设备信息")]
    //[SugarIndex("Index_{table}_TriggerDate", nameof(TriggerDate), OrderByType.Asc)]
    public class DeviceInfo
    {
        /// <summary>
        /// ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "ID")]
        public int? ID { get; set; }
        /// <summary>
        /// 设备Sn
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "设备Sn")]
        public string? DeviceSn { get; set; }
        /// <summary>
        /// 设备名称
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "设备名称")]
        public string? Name { get; set; }
        /// <summary>
        /// 设备地址
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "设备地址")]
        public string? DeviceAddress { get; set; }
        /// <summary>
        /// 设备端口
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "设备端口")]

        public int? DevicePort { get; set; }
        /// <summary>
        /// 设备类型，0、计数设备；1、识别设备
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "设备类型，0、计数设备；1、识别设备")]
        public int? DeviceType { get; set; }
        /// <summary>
        /// 用户名
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "用户名")]
        public string? UserName { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "密码")]
        public string? Password { get; set; }
        /// <summary>
        /// 服务器地址
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "服务器地址")]
        public string? ServerAddress { get; set; }
        /// <summary>
        /// 服务器监听端口
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "服务器监听端口")]
        public int? ServerPort { get; set; }
        /// <summary>
        /// 进出方向，0、出门；1、进门
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "进出方向，0、出门；1、进门")]
        public int? InOutDirection { get; set; }
        /// <summary>
        /// 启用状态
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "启用状态")]
        public bool? IsEnabled { get; set; } = true;
        /// <summary>
        /// 操作员
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "操作员")]
        public string? Operator { get; set; }
        /// <summary>
        /// 录入日期
        /// </summary>
        [SugarColumn(IsNullable = true, DefaultValue = "now()", ColumnDescription = "录入日期")]
        public DateTime? EntryDate { get; set; } = DateTime.Now;
        /// <summary>
        /// 备注
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDataType = "text", ColumnDescription = "备注")]
        public string? Notes { get; set; }
    }
}
